package com.star.uc.api;

import com.star.common.core.contract.R;
import com.star.uc.biz.UserBizService;
import com.star.uc.contract.dto.request.LoginRequest;
import com.star.uc.contract.dto.response.LoginResponse;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 登录控制器
 *
 * @author zhouhengzhe
 * @version 1.0
 * @date 2023/12/18 17:55
 */
@RestController
@RequestMapping("/user/oauth")
@RequiredArgsConstructor
@Tag(name = "LoginController", description = "登录控制器")
public class LoginController {
    private final UserBizService userBizService;

    @PostMapping("/login")
    @Operation(summary = "登录")
    public R<LoginResponse> login(@RequestBody @Valid LoginRequest loginRequest) {
        return R.ok(userBizService.login(loginRequest));
    }
}
